<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
	
<h:head>
<title>Ricerca elementi </title>
		<link rel="stylesheet" type="text/css" href="style/reset.css" media="screen,print" />
		<link rel="stylesheet" type="text/css" href="style/print.css" media="print" />
		<link rel="stylesheet" type="text/css" href="style/style.css" media="screen,print" />
		<link rel="stylesheet" type="text/css" href="style/template.css" media="screen" />
		<link rel="stylesheet" type="text/css" href="style/menu.css" media="screen" />
		<link rel="stylesheet" type="text/css" href="pcss/pagina-3.css" media="screen" />
	</h:head>


<h:body onload="#{ricerca.loadData()}">
		<div id="imHeaderBg"></div>
		<div id="imFooterBg"></div>
		<div id="imPage">
			<div id="imHeader">
				<h1 class="imHidden">Area Personale</h1>
			</div>
			<a class="imHidden" href="#imGoToCont" title="Salta il menu di navigazione">Vai ai contenuti</a>
			<a id="imGoToMenu"></a><p class="imHidden">Menu principale:</p>
			<div id="imMnMn" class="auto">
				<ul class="auto">
					<li id="imMnMnNode0" >
						<a href="http://localhost:8080/TravelDreamOnlineWeb">
							<span class="imMnMnFirstBg">
								<span class="imMnMnTxt"><span class="imMnMnImg"></span>Home Page</span>
							</span>
						</a>
					</li><li id="imMnMnNode3" >
						<a href="http://localhost:8080/TravelDreamOnlineWeb/user/index.xhtml">
							<span class="imMnMnFirstBg">
								<span class="imMnMnTxt"><span class="imMnMnImg"></span>Area Personale</span>
							</span>
						</a>
					</li><li id="imMnMnNode4" class="imMnMnCurrent">
						<a href="http://localhost:8080/TravelDreamOnlineWeb/admin/index.xhtml">
							<span class="imMnMnFirstBg">
								<span class="imMnMnTxt"><span class="imMnMnImg"></span>Area Riservata</span>
							</span>
						</a>
					</li><li id="imMnMnNode5">
						<a href="http://localhost:8080/TravelDreamOnlineWeb/contatti.html">
							<span class="imMnMnFirstBg">
								<span class="imMnMnTxt"><span class="imMnMnImg"></span>Contatti</span>
							</span>
						</a>
					</li>
				</ul>
			</div>
			<div id="imContentGraphics"></div>
			<div id="imContent">
			
<!--INSERIRE QUI LA PAGINA>
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
<-->

	<h:form>  
	<p:growl id="growl" showDetail="true" sticky="true" /> 
	
	<p:contextMenu for="dataTable">  
        <p:menuitem value="Dettaglio" icon="ui-icon-search" action="#{ricerca.dettaglio()}"/>
   		<p:menuitem value="Aggiungi a Pacchetto Predefinito" update="display1" icon="ui-icon-search" oncomplete="PF('packDialog').show()"/>  
  		<p:menuitem value="Elimina" update="dataTable" icon="ui-icon-search" action="#{elementBean.elimina(ricerca.selectedElemento)}"/>  
    </p:contextMenu>  
    

    <p:dataTable id="dataTable" var="elemento" value="#{ricerca.elementi}" widgetVar="carsTable"   
            emptyMessage="Nessun elemento trovato" filteredValue="#{ricerca.filteredElementi}"
            rowKey="#{elemento.idElementoBase}" selection="#{ricerca.selectedElemento}" selectionMode="single">  
        
        <p:column filterBy="nome"   
                headerText="Nome"
                filterMatchMode="contains">  
        <h:outputText value="#{elemento.nome}" />  
        </p:column>  

         <p:column filterBy="data"   
                headerText="Data"
                filterMatchMode="contains">  
        <h:outputText value="#{elemento.data}" />  
        </p:column>  
 
          <p:column filterBy="ora"   
                headerText="Ora"
                filterMatchMode="contains">  
        <h:outputText value="#{elemento.ora}" />  
        </p:column> 
               
        <p:column filterBy="prezzo"   
                headerText="Prezzo" 
                filterMatchMode="contains">  
        <h:outputText value="#{elemento.prezzo}" />  
        </p:column>   
        
        <p:column filterBy="tipo"   
                headerText="Tipologia" 
                filterMatchMode="contains">  
        <h:outputText value="#{elemento.tipo}" />  
        </p:column>   
        
                    
    </p:dataTable>  
      
   <p:dialog header="Pacchetti Predefiniti" widgetVar="packDialog" resizable="false"  
         width="500" showEffect="clip" hideEffect="fold" id="dialog1">  
  

    <p:dataTable id="display1" var="pacchetto" value="#{userBean.utente.pacchettiPredefiniti}" scrollable="true" scrollHeight="150">  
              
        <p:column headerText="NomePacchetto">  
            <h:outputText value="#{pacchetto.nome}" />  
        </p:column>  
        
        <p:column style="width:4%">  
                <p:commandButton id="selectButton" update="display1" action="#{pacchettoPredBean.aggiungiElemento(ricerca.selectedElemento)}" icon="ui-icon-search" oncomplete="PF('packDialog').hide();" title="Click">  
                <f:setPropertyActionListener value="#{pacchetto}" target="#{pacchettoPredBean.selectedPacchetto}"/>  
      			</p:commandButton>  
       </p:column>
  
    </p:dataTable>  
    </p:dialog>  
    
<p:commandButton value="Indietro" oncomplete = "window.history.back();"/>   
</h:form>
<!--FINE DELLA PAGINA>
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////
<-->						
				
								
			</div>		
			<div id="imFooter">
				
			</div>
	</div>
		<span class="imHidden"><a href="#imGoToCont" title="Rileggi i contenuti della pagina">Torna ai contenuti</a> | <a href="#imGoToMenu" title="Naviga ancora nella pagina">Torna al menu</a></span>
		
	<noscript class="imNoScript"><div class="alert alert-red">Per poter utilizzare questo sito è necessario attivare JavaScript.</div></noscript>
				</h:body>
</html>
